package com.tempjob.common.businesss.mongo.entity;

import com.anwen.mongo.annotation.ID;
import com.anwen.mongo.annotation.collection.CollectionField;
import com.anwen.mongo.annotation.collection.CollectionName;
import com.anwen.mongo.enums.FieldFill;
import com.anwen.mongo.enums.IdTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tempjob.common.model.FullTimeJob;
import com.tempjob.common.model.PositionModel;
import com.tempjob.common.model.TempJobInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Version;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @author hui
 * @Date 2024/11/4 15:58
 **/

@CollectionName(value = "job_info")
@Data
public class JobInfo {

    @ID(type = IdTypeEnum.OBJECT_ID)
    @CollectionField("_id")
    @ApiModelProperty("id")
    private String id;

    @CollectionField("job_status")
    @ApiModelProperty("工作状态:0未上线1已上线2已下线3强制下线")
    private Integer jobStatus;

    @CollectionField("audit_status")
    @ApiModelProperty("审核状态:1正常2审核失败")
    private Integer auditStatus;

    @CollectionField("job_type")
    @ApiModelProperty("工作类型:1零工2正式工3就业基地招聘")
    private Integer jobType;

    @CollectionField("job_category")
    @ApiModelProperty("工作分类")
    private String jobCategory;

    public Integer getJobType() {
        if (jobType == null) {
            jobType = 1;
        }
        return jobType;
    }

    @CollectionField("job_title")
    @ApiModelProperty("标题")
    private String jobTitle;

    @ApiModelProperty("学历要求")
    @CollectionField("education")
    private String education;

    @ApiModelProperty("技能要求")
    @CollectionField("skill")
    private String skill;

    @ApiModelProperty("经验要求")
    @CollectionField("experience")
    private String experience;

    @ApiModelProperty("全职工作信息")
    @CollectionField("full_time_job")
    private FullTimeJob fullTimeJob;

    @ApiModelProperty("零工工作信息")
    @CollectionField("temp_job_info")
    private TempJobInfo tempJobInfo;

    @CollectionField("job_content")
    @ApiModelProperty("工作说明")
    private String jobContent;

    @CollectionField("desc_images")
    @ApiModelProperty("介绍图片")
    private List<String> descImages;

    @CollectionField("welfare_tags")
    @ApiModelProperty("待遇标签,提供住宿、无须经验等")
    private List<String> welfareTags;

    @CollectionField("ico")
    @ApiModelProperty("ico")
    private String ico;

//    @CollectionField("location")
//    private Point location;

    @CollectionField("longitude")
    @ApiModelProperty("经度")
    private Double longitude;

    @CollectionField("latitude")
    @ApiModelProperty("纬度")
    private Double latitude;


    @ApiModelProperty("省名称")
    @CollectionField("province")
    private String province;

    @ApiModelProperty("城市名称")
    @CollectionField("city")
    private String city;

    @ApiModelProperty("区")
    @CollectionField("district")
    private String district;

    @ApiModelProperty("坐标点所在乡镇/街道（此街道为社区街道，不是道路信息）")
    @CollectionField("township")
    private String township;

    @ApiModelProperty("坐标信息")
    @CollectionField("position_info")
    private PositionModel positionInfo;

    @CollectionField("job_address")
    @ApiModelProperty("地址")
    private String jobAddress;

    @CollectionField("contact_phone")
    @ApiModelProperty("联系电话")
    private String contactPhone;

    @CollectionField("contact_name")
    @ApiModelProperty("联系人")
    private String contactName;

    @CollectionField(value = "audit_admin_id")
    @ApiModelProperty("审核人")
    private String auditAdminId;

    @CollectionField(value = "audit_admin_name")
    @ApiModelProperty("审核人")
    private String auditAdminName;

    @CollectionField(value = "audit_desc")
    @ApiModelProperty("审核内容")
    private String auditDesc;

    @CollectionField(value = "audit_time")
    @ApiModelProperty("审核时间")
    private Date auditTime;

    @CollectionField("publish_nature")
    @ApiModelProperty("工作属性:1公司发布2企业发布3个人发布")
    private Integer publishNature;

    @CollectionField("publish_user_id")
    @ApiModelProperty("发布人id")
    private String publishUserId;

    @CollectionField("publish_user_name")
    @ApiModelProperty("发布人")
    private String publishUserName;

    @CollectionField("company_id")
    @ApiModelProperty("公司id")
    private String companyId;

    @CollectionField("conpany_name")
    @ApiModelProperty("公司名称")
    private String companyName;

    @ApiModelProperty("工作时间段开始")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @CollectionField("work_on_time")
    private Date workOnTime;

    @ApiModelProperty("工作时间段结束")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @CollectionField("work_off_time")
    private Date workOffTime;

    @ApiModelProperty("截止时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @CollectionField("deadline")
    private Date deadline;

    @CollectionField(value = "update_time")
    @ApiModelProperty("更新时间")
    private Date updateTime;

    @CollectionField(value = "oper_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间",hidden = true)
    private Date operTime;

    @CollectionField(value = "oper_id",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人id",hidden = true)
    private Long operId;

    @CollectionField(value = "oper_name",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人",hidden = true)
    private String operName;

    @CollectionField(value = "create_id",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人id",hidden = true)
    private Long createId;

    @CollectionField(value = "create_name",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人",hidden = true)
    private String createName;

    @CollectionField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    @Version
    @CollectionField("version")
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;

}
